﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Code.Models;
using System.Text.RegularExpressions;
using Code.BLL.Arithmetic.Comm;

namespace Code.BLL.Arithmetic
{
    /// <summary>
    /// 重庆时时彩
    /// </summary>
    internal class CQSSC : LotteryTypeProduct
    {
        public override PlayTypeProduct GetPlayType(PlayType_E playType)
        {
            //前三直选（5，3）、前三组选、前三直和，前三组和、后三直选、后三组选、
            //后三直和、后三组和、前一、后一、前二、后二、个位和值、大小单双、不定位胆、定位胆
            PlayTypeProduct product;
            switch (playType)
            { 
                case PlayType_E.QianSanZhiXuan:
                    product = new QianSanZhiShuan(regQianSanZhiShuan );break;
                //case PlayType_E.QianSanZuShuan:
                //    product = new QianSanZuShuan(regQianSanZuShuan); break;
                case PlayType_E.QianSanZuSan:
                    product = new QianSanZuSan(regZuSan); break;
                case PlayType_E.QianSanZuLiu:
                    product = new QianSanZuLiu(regZuLiu); break;
                case PlayType_E.QianSanZhiHe:
                    product = new QianSanZhiHe(regQianSanZhiHe);break;
                case PlayType_E.QianSanZuHe:
                    product = new QianSanZuHe(regQianSanZuHe);break;
                case PlayType_E.HouSanZhiXuan:
                    product = new HouSanZhiShuan( regHouSanZhiShuan );break;
                //case PlayType_E.HouSanZuShuan:
                //    product = new HouSanZuShuan(regHouSanZuShuan); break;
                case PlayType_E.HouSanZuSan:
                    product = new HouSanZuSan(regZuSan); break;
                case PlayType_E.HouSanZuLiu:
                    product = new HouSanZuLiu( regZuLiu );break;
                case PlayType_E.HouSanZhiHe:
                    product = new HouSanZhiHe(regHouSanZhiHe);break;
                case PlayType_E.HouSanZuHe:
                    product = new HouSanZuHe(regHouSanZuHe);break; 
                //case PlayType_E.QianYi:
                //    product = new QianYi(regQianYi);break;
                //case PlayType_E.HouYi:
                //    product = new HouYi( regHouYi );break;
                case PlayType_E.Houer:
                    product = new Houer(regHouer );break;
                case PlayType_E.Qianer:
                    product = new Qianer( regQianer);break;
                //case PlayType_E.GeWeiHeZhi:
                //    product = new GeWeiHeZhi(regGeWeiHeZhi);break;
                case PlayType_E.DaXiaoDanShuan:
                    product = new DaXiaoDanShuang(regDaXiaoDanShuang );break;
                case PlayType_E.HouSanBuDingWeiDan:
                    product = new HouSanBuDingWeiDan(regHouSanBuDingWeiDan  );break;
                case PlayType_E.QianSanBuDingWeiDan:
                    product = new QianSanBuDingWeiDan(regHouSanBuDingWeiDan  );break;
                //case PlayType_E.HouSanDingWeiDan:
                //    product = new HouSanDingWeiDan(regHouSanDingWeiDan);break;
                case PlayType_E.DingWeiDan:
                    product = new WuXinDingWeiDan(regDingWeiDan);
                    break;
                default :
                    throw new ArgumentException("重庆时时彩没有找到当前玩法:"+playType);
            }
            product.lotteryType = LotteryType.CQSSC;
            return product;
        }

        #region
        private static Regex regQianSanZhiShuan = RegexFormats.ThreeStar;

        private static Regex regQianSanZuShuan = regQianSanZhiShuan;

        private static Regex regQianSanZhiHe = RegexFormats.ZhiHe;

        private static Regex regQianSanZuHe = RegexFormats.ZuHe;

        private static Regex regHouSanZhiShuan = regQianSanZhiShuan;

        private static Regex regHouSanZuShuan =  regQianSanZhiShuan;

        private static Regex regZuLiu = RegexFormats.OneStar;

        private static Regex regZuSan = RegexFormats.ZuSan;

        private static Regex regHouSanZhiHe = regQianSanZhiHe;

        private static Regex regHouSanZuHe = regQianSanZuHe;

        private static Regex regQianYi = RegexFormats.OneStar;

        private static Regex regHouYi = regQianYi;

        private static Regex regHouer = RegexFormats.TwoStar;

        private static Regex regQianer = regHouer;

        private static Regex regGeWeiHeZhi = new Regex("", RegexOptions.Compiled);//尚未写完

        private static Regex regDaXiaoDanShuang = new Regex(@"^(?![大小单双]{0,}(?<num>[大小单双])[大小单双]{0,}\k<num>)[大小单双]{1,4},(?![大小单双]{0,}(?<num>[大小单双])[大小单双]{0,}\k<num>)[大小单双]{1,4}$", RegexOptions.Compiled);

        private static Regex regHouSanBuDingWeiDan = RegexFormats.OneStar;

        private static Regex regHouSanDingWeiDan = RegexFormats.SanXingDingWeiDan;

        private static Regex regDingWeiDan = RegexFormats.WuXingDingWeiDan;
        #endregion

    }
}
